<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text" placeholder="输入用户名">
  <button id="btn">登录</button>

  <script src="/js/jquery-1.11.1.js"></script>
  <script>
    $('#btn').on('click', function () {
      console.log('561313')
      $.ajax({
        url: '/login',
        method: 'POST',
        data: {
          username: $('input').val()
        }
      })
        .done(function (res) {
          if (res.code == 200) {
            location.href = '/home.no'
          } else {
            alert(res.msg);
          }
        })
    })
  </script>
</body>

</html>